Skip to content

Fix airflowctl dagrun list crash when --state is omitted#65608

Merged
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-airflow-ctl-dagrun-list-state-none
Apr 21, 2026
Merged

Fix airflowctl dagrun list crash when --state is omitted#65608
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-airflow-ctl-dagrun-list-state-none

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 21, 2026

`DagRunOperations.list()` required a non-None `state` and unconditionally
sent `str(state)` to the API. When the CLI omitted `--state`, argparse
passed `None` and the API received the literal string `"None"`, failing
with `Invalid value for state. Valid values are queued, running, success, failed`.

Make `state` optional (`Optional[str] = None`) and only include it in the
query string when provided. Give `limit` a sensible default (100) while
we are at it so the method works when called with no args. The
auto-generated `airflowctl dagrun list` command now accepts `--state` as
a true filter instead of a required flag.

Reported in #65497 (rc2 testing).

Test plan

  • New unit test `test_list_without_state_does_not_send_state_param` asserts `state` is not present in the URL query params when omitted
  • Existing `TestDagRunOperations` suite continues to pass

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 4.7 (1M context)

Generated-by: Claude Opus 4.7 (1M context) following the guidelines

DagRunOperations.list() required a non-None state and unconditionally
sent str(state) to the API. When the CLI omitted --state, argparse
passed None and the API received the literal string "None", failing
with "Invalid value for state. Valid values are queued, running,
success, failed".

Make state optional (Optional[str] = None) and only include it in the
query string when provided. Give limit a sensible default (100) while
we are at it so the method works when called with no args. The
auto-generated `airflowctl dagrun list` command now accepts --state as
a true filter instead of a required flag.

Reported in apache#65497 (rc2 testing).
@potiuk
Copy link
Copy Markdown
Member Author

potiuk commented Apr 21, 2026

cc: @bugraoz93 - I think that one is good to fix for rc3

@potiuk potiuk added backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch backport-to-airflow-ctl-v0-1-test Backport to airflow-ctl/v0-1-test labels Apr 21, 2026
Copy link
Copy Markdown
Contributor

@bugraoz93 bugraoz93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, thanks Jarek!

@potiuk potiuk merged commit 89a021c into apache:main Apr 21, 2026
91 checks passed
@potiuk potiuk deleted the fix-airflow-ctl-dagrun-list-state-none branch April 21, 2026 18:11
@github-actions github-actions Bot added this to the Airflow 3.2.2 milestone Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.2.2 based on: backport label targeting v3-2-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

@github-actions
Copy link
Copy Markdown
Contributor

Backport failed to create: airflow-ctl-v0-1-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
airflow-ctl-v0-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 89a021c airflow-ctl-v0-1-test

This should apply the commit to the airflow-ctl-v0-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

@github-actions
Copy link
Copy Markdown
Contributor

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test PR Link

potiuk added a commit that referenced this pull request Apr 21, 2026
…65608) (#65620)

DagRunOperations.list() required a non-None state and unconditionally
sent str(state) to the API. When the CLI omitted --state, argparse
passed None and the API received the literal string "None", failing
with "Invalid value for state. Valid values are queued, running,
success, failed".

Make state optional (Optional[str] = None) and only include it in the
query string when provided. Give limit a sensible default (100) while
we are at it so the method works when called with no args. The
auto-generated `airflowctl dagrun list` command now accepts --state as
a true filter instead of a required flag.

Reported in #65497 (rc2 testing).
(cherry picked from commit 89a021c)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
potiuk added a commit that referenced this pull request Apr 21, 2026
DagRunOperations.list() required a non-None state and unconditionally
sent str(state) to the API. When the CLI omitted --state, argparse
passed None and the API received the literal string "None", failing
with "Invalid value for state. Valid values are queued, running,
success, failed".

Make state optional (Optional[str] = None) and only include it in the
query string when provided. Give limit a sensible default (100) while
we are at it so the method works when called with no args. The
auto-generated `airflowctl dagrun list` command now accepts --state as
a true filter instead of a required flag.

Reported in #65497 (rc2 testing).
potiuk added a commit that referenced this pull request Apr 21, 2026
* Fix airflowctl dagrun list crash when --state is omitted (#65608)

DagRunOperations.list() required a non-None state and unconditionally
sent str(state) to the API. When the CLI omitted --state, argparse
passed None and the API received the literal string "None", failing
with "Invalid value for state. Valid values are queued, running,
success, failed".

Make state optional (Optional[str] = None) and only include it in the
query string when provided. Give limit a sensible default (100) while
we are at it so the method works when called with no args. The
auto-generated `airflowctl dagrun list` command now accepts --state as
a true filter instead of a required flag.

Reported in #65497 (rc2 testing).

* Fix airflow-ctl missing pyyaml runtime dependency (#65489)

* Cap airflow-ctl httpx dependency below 1.0 (#65607)

httpx 1.0 (currently 1.0.dev3 on PyPI) is a ground-up API rewrite:
the entire exception hierarchy (HTTPStatusError, RequestError,
ConnectError, ReadError, TimeoutException, ...) was removed and
client/transport/auth interfaces were redesigned. airflow-ctl today
uses httpx.HTTPStatusError, httpx.ConnectError, AsyncClient, and
Response.raise_for_status() throughout api/client.py and
api/operations.py, so pre-release httpx 1.x breaks import-time
(ModuleNotFoundError / AttributeError) and the tool fails to start.

Cap to <1.0 so users who pass --pre / --prerelease=allow do not
accidentally pull the rewrite. The full migration to httpx 1.x is
tracked at #65609 and the
cap carries a comment pointing at that URL so the link survives
after this PR merges.

* Prepare airflow-ctl 0.1.4rc3 release (#65634)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl backport-to-airflow-ctl-v0-1-test Backport to airflow-ctl/v0-1-test backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants